package com.sasis.dao.ibatis;

import java.util.List;

import com.sasis.Constants;
import com.sasis.dao.UserRoleDAO;
import com.sasis.model.UserRole;

public class UserRoleDAOImpl  extends BaseDaoiBATIS implements UserRoleDAO{
	
	//private SqlMapClientTemplate template = this.getSqlMapClientTemplate();
	public int insert(UserRole record){
		getSasisSqlMapClient(Constants.FUNC_ROLE_INFO).insert("userRole_insert",record);
		return 1;
	}

    public int updateByPrimaryKey(UserRole record){
    	getSasisSqlMapClient(Constants.FUNC_ROLE_INFO).update("userRole_updateByPrimaryKey",record);
    	return 1;
    }
    
   public List select(){
	   return getSasisSqlMapClient(Constants.FUNC_ROLE_INFO).queryForList("getUserRole_All",null);
	   
   }

    public UserRole selectByPrimaryKey(UserRole record){
    	if(getSasisSqlMapClient(Constants.FUNC_ROLE_INFO).queryForObject("userRole_selectByPrimaryKey",record)instanceof UserRole){
    		return (UserRole)getSasisSqlMapClient(Constants.FUNC_ROLE_INFO).queryForObject("userRole_selectByPrimaryKey",record);
    	}
    	return null;
    }

    public int deleteByPrimaryKey(UserRole key){
    	getSasisSqlMapClient(Constants.FUNC_ROLE_INFO).delete("userRole_deleteByPrimaryKey",key);
    	return 2;
    	
    }

	public List getRoles() {
		// TODO Auto-generated method stub
		return null;
	}
}

